<template>
  <section>
    <div v-if="tableData && tableData.length > 1">
      <template v-for="(item, index) in tableData">
        <div :key="index"
             class="splitorder-info">
          <span class="left">
            <div class="iconSty-2">{{ `第${index + 1}段` }}</div>
            <icon-svg icon-name="zuoshangjiao"
                      class-name="iconSty" />
            <div v-if="index === 0"
                 class="from">运单起点</div>
            <div v-else
                 class="from line-herger28">
              <span class="grey">途经站点：</span>{{ item.stationName }}<br />
              <span class="grey">站点地址：</span>{{ item.stationAreaName
              }}{{ item.stationAddres }}<br />
              <span class="grey">联系方式：</span>{{ item.contactName }}
              {{ item.contact.contactMobile }}<br />
              <span class="grey">发货时间：</span>{{ item.toTime }}<br />
            </div>
            <!-- <img :src="require('@static/images/arrow.png')"
               class="mlr20"
               alt="" /> -->
            <icon-svg icon-name="jiantou"
                      class-name="iconSty-1" />
            <div v-if="index + 1 == tableData.length"
                 class="mlr20 from">
              运单终点
            </div>
            <div v-else
                 class="mlr20 from line-herger28">
              <span class="grey">途经站点：</span>{{ tableData[index + 1].stationName }}<br />
              <span class="grey">站点地址：</span>{{ tableData[index + 1].stationAreaName
              }}{{ tableData[index + 1].stationAddres }}<br />
              <span class="grey">联系方式：</span>{{ tableData[index + 1].contactName }}
              {{ tableData[index + 1].contact.contactMobile }}<br />
              <span class="grey">收货时间：</span>{{ tableData[index + 1].toTime }}<br />
            </div>
          </span>
          <span v-if="index === 0"
                class="right">
            <p style="color: #e52914">运单回到待调度列表</p>
          </span>
          <span v-else-if="item.carrierId"> 调度给 <span style="color:var(--prev-color-primary);margin-left: 10px;">{{ item.carrierName }}</span></span>
          <span v-else
                class="right">
            <p style="color: #e52914">运单回到待调度列表</p>
          </span>
        </div>
      </template>
    </div>
    <div v-else
         class="centerSty">
      <div class="textCenter">
        <img src="../../../../static/images/no_data.png"
             width="240px"
             height="164px" />
        <p class="fontSty">暂无数据</p>
      </div>
    </div>
  </section>
</template>

<script>
export default {
  name: "SplitScheduling",
  props: {
    processList: {
      type: Array,
      default: () => []
    }
  },
  data () {
    return {
      tableData: []
    };
  },
  watch: {
    processList: {
      handler (val) {
        if (val) {
          let arr = [...val];
          arr.splice(0, 0, val[0]);
          this.tableData = arr;
        }
      },
      deep: true
    }
  },
  methods: {
    handleChange (val) {
      console.log(val);
    }
  }
};
</script>

<style lang="scss" scoped>
.frist-row {
  margin: 15px 20px;
  font-size: 14px;
}
.splitorder-info {
  font-size: 14px;
  margin: 15px 20px;
  padding: 15px 35px 15px 0px;
  background: rgba(250, 250, 250, 0.39);
  display: flex;
  justify-content: space-between;
  align-items: center;
  .left {
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: relative;
    .iconSty {
      width: 80px;
      height: 30px;
      position: absolute;
      left: 0;
      top: -15px;
      margin: 0;
    }
    .iconSty-2 {
      position: absolute;
      left: 18px;
      top: -8px;
      z-index: 2;
      color: var(--prev-bg-white);
    }
  }
  .right {
    color: var(--prev-color-text-purered);
  }
  .from {
    margin: 0 20px 0 150px;
    min-width: 320px;
  }
  .iconSty-1 {
    width: 66px;
    height: 15px;
  }
}
p {
  margin: 0;
}
.mlr20 {
  margin: 0 20px;
}
.line-herger28 {
  line-height: 28px;
}
.centerSty {
  display: flex;
  justify-content: center;
  align-items: center;
}
.fontSty {
  font-size: 18px;
  font-weight: 400;
  line-height: 25px;
  color: var(--prev-color-text-darkgrey);
}
.textCenter {
  text-align: center;
}
.grey {
  color: var(--prev-border-color-lightgrey);
}
</style>
